import { loginRequest, needLoginRequest, uploadMultiImage } from './xhr.js'
import { env, baseURL } from './url.js'
import store from '../store'

//请求
function request() {
	const Authorization = store.state.Authorization || uni.getStorageSync('Authorization');
	if (Authorization) {
		return loginRequest(...arguments).catch(e => { throw e; });
	} else {
		return needLoginRequest(...arguments);
	}
}


export default request;
export const uploadImages = uploadMultiImage;
export const customUrl = baseURL.customUrl;
export const envVersion = env;
export const freeRequest = loginRequest;
